package redis

import "strconv"

func CacheGoods(goodsId, goodsStock int) {
	key := "goods_stock:goods_id" + strconv.Itoa(goodsId)
	for i := 0; i < goodsStock; i++ {
		RedisClient.RPush(key, goodsId)
	}
}

func GetGoodsStock(goodsId int) int64 {
	key := "goods_stock:goods_id" + strconv.Itoa(goodsId)
	return RedisClient.LLen(key).Val()
}
